package com.fr.report.js;

import com.fr.base.FCloneable;
import com.fr.base.XMLable;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.dialog.NameObject;
import com.fr.report.io.xml.ReportXMLUtils;

public class NameJavaScript extends NameObject
  implements XMLable
{
  private static final long serialVersionUID = -7431575692380012880L;
  private String name;
  private JavaScript javaScript;

  public NameJavaScript()
  {
    this(null);
  }

  public NameJavaScript(JavaScript paramJavaScript)
  {
    this("", paramJavaScript);
  }

  public NameJavaScript(String paramString, JavaScript paramJavaScript)
  {
    this.name = paramString;
    this.javaScript = paramJavaScript;
  }

  public String getName()
  {
    return this.name;
  }

  public void setName(String paramString)
  {
    this.name = paramString;
  }

  public Object getObject()
  {
    return this.javaScript;
  }

  public void setObject(Object paramObject)
  {
    this.javaScript = ((JavaScript)paramObject);
  }

  public JavaScript getJavaScript()
  {
    return this.javaScript;
  }

  public void setJavaScript(JavaScript paramJavaScript)
  {
    this.javaScript = paramJavaScript;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isAttr())
    {
      String str1;
      if ((str1 = paramXMLableReader.getAttr("name")) != null)
        setName(str1);
    }
    if (paramXMLableReader.isChildNode())
    {
      String str2 = paramXMLableReader.getTagName();
      if (("JavaScript".equals(str2)) || ("Hyperlink".equals(str2)))
        setJavaScript(ReportXMLUtils.readJavaScript(paramXMLableReader));
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("NameJavaScript").attr("name", this.name);
    ReportXMLUtils.writeXMLable(paramXMLPrintWriter, this.javaScript, "JavaScript");
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    NameJavaScript localNameJavaScript = (NameJavaScript)super.clone();
    if (this.javaScript != null)
      localNameJavaScript.setJavaScript((JavaScript)this.javaScript.clone());
    return localNameJavaScript;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof NameJavaScript))
      return false;
    NameJavaScript localNameJavaScript = (NameJavaScript)paramObject;
    if (!(localNameJavaScript.getName().equals(getName())))
      return false;
    return (localNameJavaScript.getJavaScript().equals(getJavaScript()));
  }
}